package com.wq.wrongquestion.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

@Configuration
public class webConfig extends WebMvcConfigurationSupport {
    static final String IMG_CLASS_PAHT = "classpath:/images/";  
    static final String IMG_FILE_PAHT = "file:" + System.getProperty("user.dir") + "/images/"; 
    @Override
    protected void addResourceHandlers(org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry registry) {
        
        registry.addResourceHandler("/mat/**").addResourceLocations("classpath:/static/" , IMG_FILE_PAHT); //访问URL  localhost:9091/maths/yt/11.png
        // registry.addResourceHandler("/**").addResourceLocations("classpath:/static/,classpath:/public/,classpath:/resources/,classpath:/META-INF/resources/,"+"file:"+IMG_FILE_PAHT); //访问URL  localhost:9091/maths/yt/11.png
        registry.addResourceHandler("/bio/**").addResourceLocations("classpath:/static/" , IMG_FILE_PAHT); 
        registry.addResourceHandler("/che/**").addResourceLocations("classpath:/static/" , IMG_FILE_PAHT); 
        registry.addResourceHandler("/chi/**").addResourceLocations("classpath:/static/" , IMG_FILE_PAHT); 
        registry.addResourceHandler("/eng/**").addResourceLocations("classpath:/static/" , IMG_FILE_PAHT); 
        registry.addResourceHandler("/geo/**").addResourceLocations("classpath:/static/" , IMG_FILE_PAHT); 
        registry.addResourceHandler("/his/**").addResourceLocations("classpath:/static/" , IMG_FILE_PAHT); 
        registry.addResourceHandler("/phy/**").addResourceLocations("classpath:/static/" , IMG_FILE_PAHT); 
        registry.addResourceHandler("/pol/**").addResourceLocations("classpath:/static/" , IMG_FILE_PAHT); 
        registry.addResourceHandler("/main/**").addResourceLocations("classpath:/static/" , IMG_FILE_PAHT); 
        super.addResourceHandlers(registry);
    }
    
}
